import request from './request'

export default {
  // 登录
  login: (params) => request.post('/shop/api/user/login', params),

  // 获取商品列表
  getProductList: (params) => request.get('/shop/api/shopping/goods', params),

  // 获取订单列表
  getOrderList: (params) => request.get('/shop/api/shopping/orders', params),

  // 确认订单
  confirmOrder: (params) =>
    request.post('/shop/api/shopping/orders_confirm', params),

  // 获取地址列表
  getAddressList: (params) => request.get('/shop/api/shopping/address', params),

  // 新增地址
  addAddress: (params) =>
    request.post('/shop/api/shopping/address_add', params),

  // 修改地址
  editAddress: (params) =>
    request.post('/shop/api/shopping/address_upd', params),

  // 删除地址
  delAddress: (params) => request.post('/shop/api/shopping/address_del', params),

  // ---- 矿机 ----
  miner: {
    // 登录
    login: (params) =>
      request.post('/miner/mining/user/login', params, {
        ['Content-Type']: 'multipart/form-data',
      }),

    // 提现
    withdraw: (params) =>
      request.post('/miner/mining/withdrawalRecord/add', params),

    // 获取提现消耗算力
    getConsumePower: (params) =>
      request.post('/miner/mining/withdrawalRecord/getConsumePower', params, {
        ['Content-Type']: 'multipart/form-data',
      }),

    // 获取订单详情
    getDetails: (params) =>
      request.get('/miner/mining/orderInfo/detail', params),

    // 获取质押订单
    getOrders1: (params) =>
      request.get('/miner/mining/powerDetail/list', params),

    // 获取提现订单
    getOrders2: (params) =>
      request.get('/miner/mining/withdrawalRecord/list', params),
  },
}
